/*
 * @Author: wuqingchun
 * @Date: 2024-07-01 13:57:17
 * @Description: 
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-07-01 20:38:52
 */
#ifndef __ARQ_SOCKET_H__
#define __ARQ_SOCKET_H__

#include <netinet/in.h>

typedef union tagSockAddr
{
    sockaddr_in stAddrIn;
    sockaddr_in6 stAddrIn6;
}SOCKADDR_UN;

class CARQSocket
{
public:
    CARQSocket(int iRole);

    int32_t Init(SOCKADDR_UN& refAddr);
    int32_t Send(const void* pData, size_t ulLen);
    ssize_t Recv(void* pBuf, size_t ulBufLen);
private:
    int m_iSock = -1;
    SOCKADDR_UN m_LocalAddr;  // 本端地址
    SOCKADDR_UN m_PeerAddr;   // 对端地址
    int m_iRole = 0;
};

#endif //__ARQ_SOCKET_H__